<?php
if($_SERVER['REQUEST_METHOD']=="POST") {
	$username = $_POST['username'];
	#password = $_POST['password'];
	try{
		$pdo = new PDO("mysql:host=127.0.0.1;port=3306;dbname=blog202","root","123456");
	} catch(PDOException $ex) {
		die("连接数据库失败:".$ex);
	}
	$sql = "select * from users where username='".$username."' and password='".$password."'";
	$res = $pdo->query($sql,PDO::FETCH_ASSOC);
	$row = $res->fetch();
	if($row){
		die("登录成功，欢迎".$row['username']);
	} else {
		die("登录失败");
	}
	die("post类型的请求");
}